<?php 
require_once '../include/utils.class.php';

$od = Utils::get_param('od', NULL);
if (!$od) {
  die('找不到该订单');
}

$od = json_decode($od);
?>

<div style="font-size: 12px; background: #fff; padding: 20px 10px; border: 1px solid #000; width: 680px; font-family: Trebuchet MS;">
  <div style="font-size: 16px; font-weight: bold; padding: 5px; margin-bottom: 15px; border-bottom: 1px solid #000;"><?php echo $od->__shop; ?></div>
  <table cellPadding="0" cellSpacing="0" style="width: 100%">
    <tr>
      <td style="vertical-align: top; padding-right: 5px; width: 200px;">
        <div style="font-weight: bold; padding: 5px;">订单信息</div>
        <table cellPadding="0" cellSpacing="0" style="width: 100%; border-top: 1px solid #ddd; border-right: 1px solid #ddd;">
          <tr>
            <td style="background: #eee; font-weight: bold; width: 70px; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">订单编号</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->order_number; ?></td>
          </tr>
          <tr>
            <td style="background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">日期</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->date; ?></td>
          </tr>
          <tr>
            <td style="background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">支付方式</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->payment_name; ?></td>
          </tr>
          <tr>
            <td style="background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">送货方式</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->delivery_name; ?></td>
          </tr>
        </table>
      </td>
      <td style="vertical-align: top;">
        <div style="font-weight: bold; padding: 5px;">送货地址</div>
        <table cellPadding="0" cellSpacing="0" style="width: 100%; border-top: 1px solid #ddd; border-right: 1px solid #ddd;">
          <tr>
            <td style="background: #eee; font-weight: bold; width: 50px; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">姓名</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->last_name . ' ' . $od->first_name; ?></td>
          </tr>
          <tr>
            <td style="background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">地址</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->address1; ?></td>
          </tr>
          <tr>
            <td style="background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">地址2</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->address2; ?></td>
          </tr>
          <tr>
            <td style="background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">城市</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->city; ?></td>
          </tr>
          <tr>
            <td style="background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">国家</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->country; ?></td>
          </tr>
          <tr>
            <td style="background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">邮编</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->zip; ?></td>
          </tr>
          <tr>
            <td style="background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">电话</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->phone; ?></td>
          </tr>
          <tr>
            <td style="background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">邮箱</td>
            <td style="padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $od->email; ?></td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  <div style="font-weight: bold; padding: 5px;">货物清单</div>
  <table cellPadding="0" cellSpacing="0" style="width: 100%; border-top: 1px solid #ddd; border-right: 1px solid #ddd;">
    <tr>
      <th style="background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">物品</th>
      <th style="width: 60px; background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">数量</th>
      <th style="width: 100px; background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">单价</th>
      <th style="width: 100px; background: #eee; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;">总和</th>
    </tr>
    <?php foreach ($od->__purchases as $itm) { ?>
    <tr>
      <td style="font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $itm->name . (($itm->attr_opt_code == '') ? '' : '(' . $itm->attr_opt_code . ')' ); ?></td>
      <td style="width: 60px; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $itm->quantity; ?></td>
      <td style="width: 100px; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $itm->price; ?></td>
      <td style="width: 100px; font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #ddd; border-left: 1px solid #ddd;"><?php echo $itm->total; ?></td>
    </tr>
    <?php } ?>
  </table>
  
  <div>&nbsp;</div>
  
  <div style="font-weight: bold; padding: 5px;">留言</div>
  <div style="border: 1px solid #ddd; padding: 5px;"><?php echo (($od->comment == '') ? '没有留言' : nl2br($od->comment)); ?></div>
  
  <div>&nbsp;</div>
  <div>&nbsp;</div>
  
  <div style="text-align: right;">
    <div style="font-weight: bold; padding: 5px; border: 1px solid #ddd; width: 150px; margin-left: auto;">
      <div>总价  <?php echo $od->curr . ' ' . ($od->total + $od->delivery_subtotal); ?></div>
      <div>包含运费  <?php echo $od->curr . ' ' . $od->delivery_subtotal; ?></div>
    </div>
  </div>
  
  <div>&nbsp;</div>
</div>
